// Test:
var myTransect = boreTransect({
	label: {
		dataCategory: dataCategories.DESCRIPTOR,
		attemptInterpolate: false,
		defaultValue: 'Bore ?'
	},
	linearDistance: {
		dataCategory: dataCategories.DESCRIPTOR
	},
	elevation: {
		dataCategory: dataCategories.DESCRIPTOR,
		zeroAllowed: false,
		defaultValue: 100.0
	},
	offset: {
		dataCategory: dataCategories.DESCRIPTOR
	},
	depth: {
		dataCategory: dataCategories.DESCRIPTOR
	},
	groundwaterLevel: {
		dataCategory: dataCategories.INTERFACE,
		interfaceIndex: 0,
		style: 'blue' // Or anything else that allows to style the level and the area below it.
	},
	groundwaterLevelDate: {
		dataCategory: dataCategories.DATE,
		relatesTo: 'groundwaterLevel',
		attemptInterpolate: false,
		zeroAllowed: false,
		defaultValue: '1970-01-01 00:00',
		dateFormat: 'yyyy-MM-dd H:mm'
		// If 'boreDescriptor[key].dateFormat' is provided, parsing is done with
		// date.js by Matt Kruse http://www.mattkruse.com/javascript/date/
		// Mismatches between input and format are not tolerated.
		// If no 'dateFormat' is given JavaScript's 'Date.parse()' is used.
		// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse
	},
	eh: {  // This is Eh, the redox potential.
		dataCategory: dataCategories.MEASUREMENT
	}
});

var i, 
	bore,
	dates = ['2010-01-02 9:22', '2011-02-03 12:01',  '2012-03-04 22:24'];
for (i = 0; i<10; i += 1) {
	bore = {};
	bore.label = 'Bore ' + i.toString();
	//bore.linearDistance = Math.random()*10000.0;
	bore.linearDistance = i*1000.0;
	bore.elevation = Math.random()*100.0+200.0;
	bore.offset = Math.random()*1000.0-500.0;
	bore.depth = Math.random()*80.0+10.0;
	bore.groundwaterLevel = Math.max(bore.depth-(Math.random()*10.0), 0.0);
	//bore.groundwaterLevelDate = dates[Math.floor(Math.random()*(dates.length))];
	bore.groundwaterLevelDate = dates[i % dates.length];
	bore.eh = Math.random()*0.1;
	// Make some bores incomplete:
	if (i === 0 || i === 1) {
		delete bore.label;
		bore.elevation = 0.0;
	}
	myTransect.addBore(bore);
}

var allDates, i, s = '';
//document.writeln(myTransect.asString());
alert(myTransect.asString());
//alert(myTransect.getProperties().linearDistance.toString());
allDates = myTransect.getProperties().groundwaterLevelDate;
for (i = 0; i < allDates.length; i += 1) {
	s += i + ': ' + allDates[i].toString() + ', \n';
}
alert(s);